<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>事件委托</title>
    <style>
        li{
            height: 20px;
            width: 200px;
            background-color: aqua;
            margin-top: 20px;
            color: azure;
        }
    </style>
</head>
<body>
    <ul id="parent">
        <li>html</li>
        <li>css</li>
        <li>js</li>
    </ul>
    <script>
        /* 事件委托：利用事件冒泡原理，把原来应该给子元素绑定的时间绑定在父元素上 */
        var parent=document.getElementById("parent");
        parent.onclick=function(event){
            console.log(event.target);
        }
    </script>
</body>
</html>